package org.rpgmapper.adapter;

import org.rpgmapper.R;

import android.graphics.Canvas;
import android.graphics.Point;
import android.graphics.drawable.Drawable;
import android.view.View;

public class DragShadowBuilder extends View.DragShadowBuilder {

    private Drawable shadow;

    public DragShadowBuilder(View v) {
        super(v);
        shadow = v.getContext().getResources().getDrawable(R.drawable.ic_contact_picture);
    }

    @Override
    public void onProvideShadowMetrics(Point size, Point touch) {
        int width, height;
        width = shadow.getIntrinsicWidth();//getView().getWidth();// / 2;
        height = shadow.getIntrinsicHeight();//getView().getHeight();// / 2;
        shadow.setBounds(0, 0, width, height);
        size.set(width, height);
        touch.set(width / 2, height / 2);
    }

    public void onDrawShadow(Canvas canvas) {
        shadow.draw(canvas);
    }

}
